avoid reliance on unnecessary type inference guidance #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there, unfortunately your crate depends on a type system bug which we're going to fix in future Rust versions: rust-lang/rust#141352. We've found this crate via a crater run.
The core issue is that there are two ways to prove e.g.
dyn ToJs<JsNullable<JsNumber>>: ToJs<_>:dyn ToJs<T>: ToJs<T>implementation for trait objectsimpl<T: ?Sized> ToJs<T> for T where T: UseInJsCode {}UseInJsCodealso succeeds asUseInJsCodeis a super trait ofToJsWe previously always used the builtin implementaiton to constrain
_toJsNullable<JsNumber>in here, but constraining it todyn ToJs<JsNullable<JsNumber>>would also be valid when considering this where-bound in isolation. We will no longer prefer this builtin implementation going forward, causing this to remain ambiguous.This causes calls to the
wsdom_macros::load_tsmacro to fail with ambiguity errors:From what I can tell this happens in
wsdom/wsdom-ts-convert/src/generator/function.rs
Lines 19 to 25 in 2227a28
wsdom/wsdom-core/src/internal/upcast_workaround.rs
Lines 8 to 9 in 2227a28
While the builtin impl does not work to create an
UpcastWorkaroundas constrainingJsTypetodyn ToJs<JsNullable<JsNumber>>results in adyn ToJs<JsNullable<JsNumber>>: Sizedbound which does not hold, this information does not get considered when checkingdyn ToJs<JsNullable<JsNumber>>: ToJs<_>by itself.I am unsure whether this is the best way to fix the breakage, but from what I can tell there are no unsized types which implement
UseInJsCode🤔